package com.biodiv.miracle.web.handler;

import com.biodiv.miracle.web.servlet.DispatcherServlet;

import javax.servlet.http.HttpServletRequest;

/**
 * @Author: tianquan
 * @CreateTime: 2025-05-26  17:41
 * @Description: RequestMapping处理器映射器
 * @Version: 1.0
 */
public class RequestMappingHandlerMapping extends AbstractHandlerMapping {

    @Override
    protected Object getHandlerInternal(HttpServletRequest request) {
        DispatcherServlet dispatcherServlet = (DispatcherServlet) request.getAttribute("dispatcherServlet");
        String method = request.getMethod();
        String path = request.getRequestURI();
        return dispatcherServlet.getHandlerMethod(method, path);
    }

}
